<?php
	ini_set('date.timezone','Asia/Shanghai');
	header("content-type:text/html;charset=utf-8");

   	$mysql_conf = array(
        'host'    => '127.0.0.1', 
        'db'      => 'yjhx', 
        'db_user' => 'root', 
        'db_pwd'  => 'root', 
    );
   	//接收表单传递的用户名和密码

    $mysqli = @new mysqli($mysql_conf['host'],$mysql_conf['db_user'],$mysql_conf['db_pwd']);

    if ($mysqli->connect_errno) {
        die("could not connect to the database:\n" . $mysqli->connect_error);//诊断连接错误
    }
    $mysqli->query("set names 'utf8';");//编码转化
    $select_db = $mysqli->select_db($mysql_conf['db']);
    if (!$select_db) {
        die("could not connect to the db:\n" .  $mysqli->error);
    }
    
    $sql="SELECT COUNT(*) AS count FROM user ";
	$result=mysqli_fetch_array($mysqli->query($sql)); 
	$count=$result['count'];

	echo $count;

	$mysqli->close();

?>